package com.primi.chen.spiders.proxypool;

import com.cv4j.proxy.ProxyListPageParser;
import com.cv4j.proxy.ProxyManager;
import com.cv4j.proxy.ProxyPool;
import com.cv4j.proxy.domain.Proxy;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

/**
 * Create AT 2020/3/9 10:57:10:57
 *
 * @author Primi.Chen(Chenxiangxu)
 */
@Data
@Slf4j
public class SpiderProxyPoolDemo {

    public static void main(String[] args) throws ClassNotFoundException, InterruptedException {
        System.out.println("Start...");
        Class<?> clas = Class.forName("com.primi.chen.spiders.proxypool.ProxyListPlusPageParser");
        ProxyPool.proxyMap.put("http://www.66ip.cn/mo.php?sxb=&tqsl=60&port=&export=&ktip=&sxa=&submit=%CC%E1++%C8%A1&textarea=", clas.asSubclass(ProxyListPageParser.class));
        ProxyManager proxyManager = ProxyManager.get();
        proxyManager.start();
        for (Proxy proxy : ProxyPool.proxyList) {
            log.info("{}",proxy);
        }
    }

}
